package com.booksys.service.Impl;

import com.booksys.mapper.ProvinceDao;
import com.booksys.pojo.Province;
import com.booksys.pojo.ProvinceExample;
import com.booksys.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProvinceServiceImpl implements ProvinceService {

    @Autowired
    private ProvinceDao provinceDao;

    @Override
    public List<Province> getProvinces(int provinceId) {
        ProvinceExample provinceExample = new ProvinceExample();
        ProvinceExample.Criteria criteria = provinceExample.createCriteria();
        if(provinceId!=0){
            criteria.andIdEqualTo(provinceId);
        }
        List<Province> list = provinceDao.selectByExample(provinceExample);
        return list;
    }
}
